package com.pro.service.imple;

import com.pro.mapper.JsUserMapper;
import com.pro.pojo.JsLoginRecord;
import com.pro.pojo.JsMenu;
import com.pro.pojo.JsMonthCount;
import com.pro.pojo.JsUser;
import com.pro.service.JsUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsUserServiceImple
 * Package:com.pro.service.imple
 * Description: 登录serviceImple层
 *
 * @Date:2021/11/3 上午 11:37
 * @Author:太宰
 */
@Service
public class JsUserServiceImple implements JsUserService {

    @Autowired(required = false)
    private JsUserMapper jsUserMapper;

    /* 登录 */
    @Override
    public JsUser getJsUser(String account, String password) {
        JsUser jsUser = jsUserMapper.getJsUser(account, password);
        return jsUser;
    }

    /* 添加登录日志 */
    @Override
    public Boolean addJsLoginRecord(JsLoginRecord jsLoginRecord) {
        Boolean aBoolean = jsUserMapper.addJsLoginRecord(jsLoginRecord);
        return aBoolean;
    }

    /*修改密码*/
    @Override
    public Boolean updateUser(Integer userId,String acatarUrl,String password) {
        return jsUserMapper.updateUser(userId,acatarUrl,password);
    }

    /*获取用户登录信息*/
    @Override
    public List<JsUser> getLoginMsg(String account) {
        List<JsUser> acc=jsUserMapper.getLoginMsg(account);
        return acc;
    }

    @Override
    public JsUser loginByName(String username) {
        return jsUserMapper.loginByName(username);
    }

    //判断是否解封
    public List<Integer> selectUserEndDate(Integer userId,String endDate){
        List<Integer> integers = jsUserMapper.selectUserEndDate(userId, endDate);
        return integers;
    };
    @Override
    public int count() {
        return jsUserMapper.count();
    }

    @Override
    public List<JsMonthCount> countMonth() {
        return jsUserMapper.countMonth();
    }

}
